//
//  Data.m
//  __PRODUCTNAME__
//
//  Created by 鹏飞罗 on 16/08/15
//  Copyright (c) dllo. All rights reserved.
//

#import "Data.h"
#import "ALData.h"
#import "Action.h"
@implementation Data
- (void)setValue:(id)value forKey:(NSString *)key {
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"action"]) {
        Action *action = [Action modelWithDictionary:value];
        _action = action;
    }
    
    if ([key isEqualToString:@"data"]) {
        NSMutableArray<ALData *> *ALDataArray = [NSMutableArray array];
        NSArray *ALDataArr = value;
        for (NSDictionary *ALDataDic in ALDataArr) {
            ALData *alData = [ALData modelWithDictionary:ALDataDic];
            [ALDataArray addObject:alData];
        }
        _data = ALDataArray;
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"id"]) {
        _data_id = [value integerValue];
    }
}

+ (NSDictionary *)objectClassInArray{
    return @{@"data" : [ALData class]};
}

@end
